package com.py.framework.core.helper;

import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;

import com.py.framework.core.exception.ServiceException;

/**
 * 绯荤粺鍏敤鐨刄RL杈呭姪绫�
 * @author Leegern
 * @date   2018骞�5鏈�10鏃�
 */
@Service
public class UrlHelper implements InitializingBean {
	
	/** 鏀拺骞冲彴鏈嶅姟鍦板潃 **/
	@Value("${base.server.url}")
	private String baseServerUrl;
	
	/** 浠诲姟璋冨害骞冲彴鍦板潃 **/
	@Value("${scheduler.task.url}")
	private String schedulerServerUrl;

	/** 业务系统服务地址 **/
	@Value("${base.platform.url}")
	private String platformServerUrl;
	
	/** 联合奖惩服务地址 **/
	@Value("${base.mess.url}")
	private String baseMessUrl;
	
	/** 信用评价服务地址 **/
	@Value("${base.xypj.url}")
	private String baseXypjUrl;
	

	/**
	 * 鑾峰彇鏀拺骞冲彴鏈嶅姟鍦板潃
	 * @return the baseServerUrl
	 */
	public String getBaseServerUrl() {
		return baseServerUrl;
	}

	/**
	 * 浠诲姟璋冨害骞冲彴鏈嶅姟鍦板潃
	 * @return the schedulerServerUrl
	 */
	public String getSchedulerServerUrl() {
		return schedulerServerUrl;
	}

	/**
	 * 获取业务系统服务地址
	 * @return the platformServerUrl
	 */
	public String getPlatformServerUrl() {
		return platformServerUrl;
	}
	
	/**
	 * 获取联合奖惩服务地址
	 * @return the platformServerUrl
	 */
	public String getBaseMessUrl() {
		return baseMessUrl;
	}
	
	/**
	 * 获取信用评价服务地址
	 * @return the platformServerUrl
	 */
	public String getBaseXypjUrl() {
		return baseXypjUrl;
	}

	/*
	 * (non-Javadoc)
	 * @see org.springframework.beans.factory.InitializingBean#afterPropertiesSet()
	 */
	@Override
	public void afterPropertiesSet() throws Exception {
		if (StringUtils.isBlank(baseServerUrl)) {
			throw new ServiceException("baseServerUrl is null, please check it.");
		}
//		if (StringUtils.isBlank(schedulerServerUrl)) {
//			throw new ServiceException("schedulerServerUrl is null, please check it.");
//		}
	}
}